#ifndef NARRATIONWIDGET_H
#define NARRATIONWIDGET_H
#include <QListWidget>
#include "narrationwidgetitem.h"
#include <QVector>
#include <QLineEdit>
class NarrationWidget:public QListWidget
{
public:
    NarrationWidget(QWidget* parent = nullptr);
    ~NarrationWidget();
    void LoadTree(NarrationNode* root,int curRowId = 0);
    void ShowBranchs(NarrationNode* node);
    QVector<QListWidgetItem*> items;
    void Clear();
    void Init(QWidget* parent);
    void Back();
    void ShowEdit();
    void ChangeCurNode(int id);
protected:
    void keyPressEvent(QKeyEvent *event);
private:
    QLineEdit* edit = nullptr;
    //复制节点，剪贴板的节点id
    int copyId = -1;
public slots:
    void AddNode(int id);
    void DeleteNodeItem(int row);
};

#endif // NARRATIONWIDGET_H
